package com.serverTechnology.teamsGroups.controller;


import cn.stylefeng.roses.kernel.rule.pojo.response.ResponseData;
import cn.stylefeng.roses.kernel.rule.pojo.response.SuccessResponseData;
import cn.stylefeng.roses.kernel.scanner.api.annotation.ApiResource;
import com.serverTechnology.teamsGroups.entity.dto.TeWarehouseAddEditDto;
import com.serverTechnology.teamsGroups.entity.vo.TeWarehouseEditVo;
import com.serverTechnology.teamsGroups.service.ITeWarehouseService;
import com.serverTechnology.teamsGroups.service.LocationTypeService;
import com.serverTechnology.teamsGroups.service.impl.TeShelfServiceImpl;
import com.serverTechnology.teamsGroups.service.impl.TeWarehouseInforServiceImpl;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.net.InetAddress;
import java.net.UnknownHostException;

/**
 * <p>
 * 仓库 前端控制器
 * </p>
 *
 * @author 王凯炫
 * @since 2024-08-06
 */
@RestController
@RequestMapping("/warehouse")
@ApiResource(name = "仓库接口")
@Api(tags = "仓库管理")
public class TeWarehouseController {
    @Resource(name = "teWarehouseServiceImpl")
    private ITeWarehouseService iTeWarehouseService;

    /**
     * 添加修改仓库
     * @return
     */
    @PostMapping("/warehouseAdd")
    @ApiOperation(value = "添加仓库")
    public ResponseData warehouseadd(@RequestBody @Validated TeWarehouseAddEditDto teWarehouseAddEditDto) {
        iTeWarehouseService.warehouseadd(teWarehouseAddEditDto);
        return new SuccessResponseData<>();
    }

    /**
     * 查询仓库详情
     */
    @GetMapping("/warehouseSel")
    @ApiOperation(value = "查询仓库详情")
    public ResponseData<TeWarehouseEditVo> warehouseSel(@RequestParam Long id) {
        return new SuccessResponseData<>(iTeWarehouseService.getByIds(id));
    }


}
